package com.lihaozhe.dto;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

/**
 * @author 李昊哲
 * @version 1.0
 * 2021/12/8 上午11:31
 */

public class SecUser implements UserDetails {
    private long id;
    private String username;
    private String password;
    private byte enabled;
    private byte accountNonExpired;
    private byte accountNonLocked;
    private byte credentialsNonExpired;


    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }


    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return accountNonExpired == 1 ? true : false;
    }

    @Override
    public boolean isAccountNonLocked() {
        return accountNonLocked == 1 ? true : false;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return credentialsNonExpired == 1 ? true : false;
    }

    @Override
    public boolean isEnabled() {
        return enabled == 1 ? true : false;
    }

    public void setUsername(String username) {
        this.username = username;
    }


    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public byte getEnabled() {
        return enabled;
    }

    public void setEnabled(byte enabled) {
        this.enabled = enabled;
    }


    public byte getAccountNonExpired() {
        return accountNonExpired;
    }

    public void setAccountNonExpired(byte accountNonExpired) {
        this.accountNonExpired = accountNonExpired;
    }


    public byte getAccountNonLocked() {
        return accountNonLocked;
    }

    public void setAccountNonLocked(byte accountNonLocked) {
        this.accountNonLocked = accountNonLocked;
    }


    public byte getCredentialsNonExpired() {
        return credentialsNonExpired;
    }

    public void setCredentialsNonExpired(byte credentialsNonExpired) {
        this.credentialsNonExpired = credentialsNonExpired;
    }
}
